//
//  DDImageDetailCollectionViewCell.m
//  LuPingBox
//
//  Created by 茶 on 2023/11/1.
//  Copyright © 2023 DD. All rights reserved.
//

#import "CADetailCollectionViewCell.h"

@interface CADetailCollectionViewCell ()

@property (nonatomic, strong) UIImageView *coverImageView;

@end

@implementation CADetailCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self.contentView addSubview:self.coverImageView];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.coverImageView.frame = self.contentView.bounds;
}

- (void)setModel:(CASavedModel *)model {
    _model = model;
    _coverImageView.image = [UIImage imageWithContentsOfFile:model.imgPath];
}

- (UIImageView *)coverImageView {
    if (!_coverImageView) {
        _coverImageView = [[UIImageView alloc] init];
        _coverImageView.contentMode = UIViewContentModeScaleAspectFit;
        _coverImageView.clipsToBounds = YES;
    }
    return _coverImageView;
}

@end
